import React from "react";
import { Button, Dropdown, Space } from "antd";
import dictTag from "@/component/Dict-Tag/Dict-Tag";
import { DownOutlined, SmileOutlined } from '@ant-design/icons';
import { DICT_TYPE, getIntDictOptions } from "@/utils/dict";




/**@description 列表表格字段 */
const getColumns = ({ open = Function, handleDelete = Function, onHandleClickOpenCustDetail = Function }) => {
    const items = [
        {
            key: '1',
            label: (
                <a target="_blank" rel="noopener noreferrer" href="https://www.antgroup.com">
                    冻结
                </a>
            ),
        },

        {
            key: '4',
            danger: true,
            label: '删除',
            click: (record, index) => {
                handleDelete(record, index)
            }
        },
    ];

    const columns = [
        {
            title: "客户姓名",
            key: "custName",
            dataIndex: "custName",
            width: 180,
            ellipsis: true,
        },
        {
            title: "客户ID",
            key: "custId",
            dataIndex: "custId",
            width: 180,
        },
        {
            title: "客户邮箱",
            key: "custEmail",
            dataIndex: "custEmail",
            width: 280,
        },
        {
            title: "手机号/phoneNo",
            key: "phoneNo",
            dataIndex: "phoneNo",
            width: 180,
        },
        // {
        //     title: "排序",
        //     key: "sort",
        //     dataIndex: "sort",
        //     width: 80,
        // },
        {
            title: "状态",
            key: "status",
            dataIndex: "status",
            width: 80,
            render: (value, record) => dictTag({
                type: DICT_TYPE.COMMON_STATUS,
                value: value
            })
        },

        {
            title: "操作",
            key: "action",
            dataIndex: "action",
            width: 300,
            render: (text, record) => {
                return (
                    <>
                        <Button type="link" onClick={() => onHandleClickOpenCustDetail({ type: "open", record })}>详情</Button>
                        <Button type="link" onClick={() => open({ type: "update", record })}>编辑</Button>
                        <Dropdown
                            menu={{
                                items,
                            }}
                        >
                            <a onClick={(e) => e.preventDefault()}>
                                <Space>
                                    更多操作
                                    <DownOutlined />
                                </Space>
                            </a>
                        </Dropdown>
                    </>
                )
            }
        },
    ];
    return columns;
}

export default getColumns;